package com.gege.homework9.service.impl;

import com.gege.homework9.datasource.CurDataSource;
import com.gege.homework9.datasource.DataSourceNames;
import com.gege.mapper.OrderMapper;
import com.gege.model.Order;
import com.gege.homework9.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author gechenpeng
 * @date 2021-05-21
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public Order findOrderByFirstDb(Long id) {
        return orderMapper.selectById(id);
    }

    @Override
    @CurDataSource(name = DataSourceNames.SECOND)
    public Order findOrderBySecondDb(Long id) {
        return orderMapper.selectById(id);
    }
}
